// 1 定义 要使用的url
/**
 * 首页轮播图
 */
const HOMESWIPERDATA = "/home/swiperdata";
/**获取导航数据 */
const HOMECATITEMSDATA = "/home/catitems";
/**获取楼层数据 */
const HOMEFLOORDATA = "/home/floordata";
/**获取商品分类 */
const CATEGORIESDATA = "/categories";
/**商品列表 */
const GOODSSEARCH = `/goods/search`;
/**商品详情 */
const GOODSDETAIL = `/goods/detail`;
/**商品搜索 */
const GOODSQSEARCH = `/goods/qsearch`;



const install = (Vue, vm) => {
  /**首页轮播图 */
  let getHomeSwiperData = (params = {}) => vm.$u.get(HOMESWIPERDATA, params);
  /**首页导航 */
  let getHomeCatitemsData = (params = {}) =>
    vm.$u.get(HOMECATITEMSDATA, params);
  /**获取楼层数据 */
  let getHomeFloorData = (params = {}) => vm.$u.get(HOMEFLOORDATA, params);
  /**获取商品分类 */
  let getCategoriesData = (params = {}) => vm.$u.get(CATEGORIESDATA, params);
  // 获取商品列表
  let getGoodsSearch = (params = {}) => vm.$u.get(GOODSSEARCH, params);
  // 获取商品详情
  let getGoodsDetail = (params = {}) => vm.$u.get(GOODSDETAIL, params);
   // 获取商品搜索  没卵用 没图片
   let getGoodsQsearch = (params = {}) => vm.$u.get(GOODSQSEARCH, params);

  // 3 添加 vm.$u.api 对象上
  vm.$u.api = {
    getHomeSwiperData,
    getHomeCatitemsData,
    getHomeFloorData,
    getCategoriesData,
    getGoodsSearch,
    getGoodsDetail,
    getGoodsQsearch
  };
};

export default {
  install,
};
